import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import PathConfig from "./config"
Vue.use(VueRouter)

const routes = [
  {
    path: PathConfig.HOME,
    name: 'Home',
    component: Home,
    meta:{
      isShowAppBt:true
    }
  },
  // {
  //   path: '/about',
  //   name: 'About',
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
  //   meta:{
  //     isShowAppBt:true
  //   }
  // },
  {
    path: PathConfig.LISTOF,
    name: 'ListOf',
    component: () => import(/* webpackChunkName: "about" */ '../views/ListOf.vue'),
    meta:{
      isShowAppBt:true
    }
  },
  {
    path: PathConfig.ARTICLE,
    name: 'article',
    component: () => import(/* webpackChunkName: "about" */ '../views/Article.vue'),
    meta:{
      isShowAppBt:true
    }
  },
  {
    path: PathConfig.SELECOLUMN,
    name: 'SeleColumn',
    component: () => import(/* webpackChunkName: "about" */ '../views/SeleColumn.vue'),
    meta:{
      isShowAppBt:true
    }
  },
  {
    path: PathConfig.USER,
    name: 'User',
    component: () => import(/* webpackChunkName: "about" */ '../views/User.vue'),
    meta:{
      isShowAppBt:true
    }
  },
  {
    path:PathConfig.LOGIN,
    name: 'Login',
    component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue'),
    meta:{
      isShowAppBt:false
    }
  },
  {
    path:PathConfig.LISTYS,
    name: 'Listys',
    component: () => import(/* webpackChunkName: "about" */ '../views/Listys.vue'),
    meta:{
      isShowAppBt:false
    }
  },
  {
    path:PathConfig.SEARCH,
    name: 'Search',
    component: () => import(/* webpackChunkName: "about" */ '../views/Search.vue'),
    meta:{
      isShowAppBt:true
    },
    children:[
      {
        path:PathConfig.SEARCH,
        name: 'Search',
        component: () => import("../components/Search/Suoyou.vue"),
        meta:{
          isShowAppBt:true
        },
      },
      {
        path:PathConfig.JUJIA,
        name: 'Jujia',
        component: () => import("../components/Search/Jujia.vue"),
        meta:{
          isShowAppBt:true
        },
      },
      {
        path:PathConfig.PEISHI,
        name: 'Peishi',
        component: () => import("../components/Search/Peishi.vue"),
        meta:{
          isShowAppBt:true
        },
      },
      {
        path:PathConfig.FUSHI,
        name: 'Fushi',
        component: () => import("../components/Search/Fushi.vue"),
        meta:{
          isShowAppBt:true
        },
      },
      {
        path:PathConfig.DIANQI,
        name: 'Dianqi',
        component: () => import("../components/Search/Dianqi.vue"),
        meta:{
          isShowAppBt:true
        },
      }
    ]
  },
  {
    path:PathConfig.SEARCHLIST,
    name: 'Searchlist',
    component: () => import(/* webpackChunkName: "about" */ '../views/Searchlist.vue'),
    meta:{
      isShowAppBt:false
    }
  },
  {
    path: PathConfig.MALL,
    name: 'Mall',
    component: () => import('../views/Mall.vue'),
    meta:{
      isShowAppBt:true
    }
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
// let Token = JSON.parse(localStorage.getItem("token"));
// router.beforeEach((to,from,next)=>{
//   if(to.path === "/login"){
//     next();
//   }else if(Token){
//     next();
//   }else{
//     next("/login")
//   }
// })
export default {
  install(Vue){
    Vue.prototype.$myRouter = this;
  },
  router,
  PathConfig,
  push(path){
    path.PathConfig
  }
}
